package com.hnevc.cnlizhimaomxbc.util;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

public class DB {
    private Context context;
    public DB(Context context){
        this.context = context;
    }
    public boolean loginSelect(String username,String student_id) {
        MyHelper myHelper = new MyHelper(context);
        SQLiteDatabase db = myHelper.getReadableDatabase();
        Cursor cursor = db.rawQuery("select * from account where username=? and student_id = ?",new String[]{username,student_id});
        if (cursor.getCount() != 0) {
            return true;
        }else {
            return false;
        }
    }
    public boolean signInsert(String username,String student_id){
        MyHelper myHelper = new MyHelper(context);
        SQLiteDatabase db = myHelper.getWritableDatabase();
        db.execSQL("insert into account(username,student_id) values(?,?)",new Object[]{username,student_id});
        return true;
    }
}
